<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8" />
<title>Cropped TIFF - PanoTools.org Wiki</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="generator" content="MediaWiki 1.23.6" />






<style media="screen" type="text/css" title="Screen style sheet"> @import url(manual.css); </style>

<style>a:lang(ar),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}
/* cache key: panotools_wiki:resourceloader:filter:minify-css:7:90730a7865ba4b50e0b837e1821ff0a3 */</style>



<!--[if lt IE 7]><style type="text/css">body{behavior:url("/skins/vector/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-Cropped_TIFF skin-vector action-view vector-animateLayout">
		
		
		<div id="content" class="mw-body" role="main">
			<a id="top"></a>
			
						<h1 id="firstHeading" class="firstHeading" lang="en"><span dir="auto">Cropped TIFF</span></h1>
						<div id="bodyContent">
								<div id="siteSub">From PanoTools.org Wiki</div>
								
												
				<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><p><br />
A common situation when stitching images together is that most of the output image or layer is empty.  This happens particularly during <a href="Perspective_correction.html" title="Perspective correction">perspective correction</a> or when creating High resolution partial panoramas<a class="external" href="http://wiki.panotools.org/High_resolution_partial_panoramas">[*]</a> from large numbers of photos.
</p><p>This is ok except that <a href="Panorama_tools.html" title="Panorama tools">panorama tools</a> will labouriously process the geometry for all these empty pixels, which then consume valuable memory and disc space.
</p><p>The <a href="TIFF.html" title="TIFF">TIFF</a> specification allows for an image canvas to include a smaller image at an offset within the larger area using the <b>XPOSITION</b>, <b>YPOSITION</b>, <b>TIFFTAG_PIXAR_IMAGEFULLWIDTH</b> and <b>TIFFTAG_PIXAR_IMAGEFULLHEIGHT</b> TIFF tags, which is ideal for a typical panoramic image that is mostly empty space.
</p><p><a href="Hugin.html" title="Hugin">hugin</a>, <a href="Nona.html" title="Nona">nona</a> and <a href="PTmender.html" title="PTmender">PTmender</a> can be told to create such <b>cropped TIFF</b> files by adding <i>r:CROP</i> as a TIFF option to the <i>panorama format</i> section of the <i>p</i> line in a stitching script.  Two <a href="TIFF.html" title="TIFF">TIFF</a> output formats are supported, <i>TIFF_m</i> and <i>TIFF_multilayer</i> (note that TIFF_multilayer is only supported by <a href="Nona.html" title="Nona">nona</a>).
</p><p>For example the following <i>p</i> line produces multiple cropped TIFF files with LZW compression:
</p>
<pre> p f0 w1000 h500 v120 n"TIFF_m c:LZW r:CROP"
</pre>
<p><a href="Enblend.html" title="Enblend">enblend</a> can read these <b>cropped TIFF</b> files since version 2.4, so this technique is useful when working with enblend.  Additionally the gimp<a class="external" href="http://wiki.panotools.org/Gimp">[*]</a> image editor can open multilayer <b>cropped TIFF</b> files directly, though it cannot save them. It can be convenient to edit the alpha masks in multi-layer TIFFs before passing them to enblend with the help of a script; see Multi-Layer TIFF editing with the Gimp<a class="external" href="http://wiki.panotools.org/Multi-Layer_TIFF_editing_with_the_Gimp">[*]</a>.
</p>
<h2><span class="mw-headline" id="Preserving_TIFF_offset_when_editing_with_GIMP">Preserving TIFF offset when editing with GIMP</span></h2>
<p>Using cropped intermediate images is very useful - they use less diskspace and less resources are needed to generate them. Unfortunately, GIMP does not preserve the TIFF offset - and this is very unfortunate if you want to mask out some passing object in some of the remapped images, and blend them later with enblend. There's a way to preserve TIFF offset, though. First we have to figure out what the original offset of the image we will be editing is (of course, it is suggested to create a backup copy of the image anyway). To find that out, execute:
</p>
<pre>tiffdump &lt;remappedd.tiff&gt; | grep Position
</pre>
<p>an example output could be:
</p>
<pre>XPosition (286) RATIONAL (5) 1&lt;19.1667&gt;
YPosition (287) RATIONAL (5) 1&lt;2.54&gt;
</pre>
<p>Here we can see that both X and Y offset is used. Important values in this output are <b>286</b> and <b>287</b>, which denote TIFF data entries. Values at the end are actual offsets (19.1667 and 2.54).
</p><p>Now, after editing the image in gimp, we will want to restore these offsets like:
</p>
<pre>tiffset -s 286 19.1667 &lt;remappedd.tiff&gt;
tiffset -s 287 2.54 &lt;remappedd.tiff&gt;
</pre>
<p>Of course, if one of the offsets is <b>0</b> when dumping the data, there is no need to set it on the resulting image. Both <i>tiffdump</i> and <i>tiffset</i> are part of the libtiff package.
</p>



</div>								<div class="printfooter">
				Retrieved from "http://wiki.panotools.org/index.php?title=Cropped_TIFF&amp;oldid=11669<a class="external" href="http://wiki.panotools.org/index.php?title=Cropped_TIFF&amp;oldid=11669">[*]</a>"				</div>
												</div></div></body></html>